/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.jitag.ui;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

import sk.jp.commons.ui.LinePanel;
import sk.jp.jitag.ui.common.IconLoader;
import sk.jp.jitag.ui.common.Icons;
import sk.jp.jitag.util.Msg;

public class EditModePanel extends JPanel {

    private JTextField addTagTextBox;

    //----------------------------------------------------------------------

    public EditModePanel() {
        init();
    }

    //----------------------------------------------------------------------

    //----------------------------------------------------------------------

    private void init(){
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        JPanel linePanel;

        //

        linePanel = new LinePanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
        add(linePanel);
        linePanel.add(new JLabel(Msg.m.value())); //Edit images

        //

        linePanel = new LinePanel();
        add(linePanel);
        linePanel.setLayout(new BoxLayout(linePanel, BoxLayout.X_AXIS));

        addTagTextBox = new JTextField("");
        linePanel.add(addTagTextBox);

        ImageIcon addIcon = IconLoader.loadIcon(Icons.add);
        JButton button = new JButton(addIcon);
        linePanel.add(button);
        button.setMargin(new Insets(1, 1, 1, 1));
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("text: "+addTagTextBox.getText());//TODO test
            }
        });

//        add(Box.createVerticalGlue());

        JList allTagsList = new JList(new String[]{"fotky", "vylet", "recept"});
        add(allTagsList);
        allTagsList.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    }

}
